<?php
/**
 * Loop Author
 * The main template file for display portfolio page.
 * Author : TT &mannatstdio
 * @package WordPress
*/
wp_enqueue_script('prettyPhoto');
while(have_posts()) : the_post();


$imagethumb = '';
$image_fullwidth ='';


if(has_post_thumbnail())
{
$imageid=get_post_thumbnail_id(get_the_ID());
$imagethumb = wp_get_attachment_image_src($imageid,'size-680-300');
$image_fullwidth = wp_get_attachment_image_src($imageid,'size-680-300');

}
?>
<!-- About Content Start -->
        	
                <div class="blog-post">
                 	<h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
                    <?php
					$blog_enable_lightbox =get_theme_option('blog','blog_enable_lightbox');
					if($blog_enable_lightbox=='true') :
					 ?>
					 
					<div class="hover-img">
                        <a rel="prettyPhoto" class="zoom fade-img" href="<?php echo $image_fullwidth[0]; ?>" title="<?php the_title(); ?>"></a>
                        <a href="<?php the_permalink(); ?>" class="fade-img"></a>
                        <img src="<?php echo get_stylesheet_directory_uri(); ?>/timthumb.php?src=<?php echo $imagethumb[0];?>&amp;h=300&amp;w=690&amp;zc=1" alt="<?php the_title(); ?>">
                        <i style="opacity: 0;"></i>
                    </div>
					<?php
					else : 
					?>
					
					<img src="<?php echo $imagethumb[0];?>" alt="<?php the_title(); ?>">
					<?php
					endif;
					?>
					
                    <div class="post-text">
						 <?php
						 $blog_enable_time = get_theme_option('blog','blog_enable_time');
						 if($blog_enable_time == true) :
						 ?>
						 
                    	<a class="col1-12" href="<?php the_permalink(); ?>">
							<span><?php echo get_the_time('d'); ?></span>
							<span class="post-date"><?php echo get_the_time('M'); ?></span>
							<span class="num-comm"><?php echo get_comments_number(get_the_ID());?></span>
						</a>
						<?php endif; ?>
						
                        <div class="post">
							 <?php
							 $enable_show_category = get_theme_option('blog','blog_enable_category');
							 $enable_show_author = get_theme_option('blog','blog_enable_author');
							 
							 $arr_cats = array();
							 $i=0;
							 $cats = get_the_category(get_the_ID());
							 ?>
							<?php  if($enable_show_author =='true'): ?>
							
							<p class="auth-cat"><?php echo esc_html('Posted by','TT'); ?> <strong><a href="<?php get_permalink(get_the_ID(),'author'); ?>"><?php the_author(); ?></a></strong>
							<?php endif ?> 
							<?php foreach($cats as $cat): 
							$arr_cats[$i]='<a class="clr-link" href="'.get_category_link($cat->cat_ID ).'">'.$cat->cat_name.'</a>';
							$i++;
							?>
							<?php endforeach; ?>
							<?php 
							if($enable_show_category =='true') :
							echo esc_html__('In ','TT').implode(',',$arr_cats); 
							endif;
							?>
							
							<img alt="" src="images/comment_icon.png" class="ml-10"></p>
							<?php
							$exceptlength= get_theme_option('blog','blog_except_length'); 
							?>
                    		<?php echo tt_substr(get_the_excerpt(),$exceptlength);?>
							
							<br/>
							<?php 
							$readmore = get_theme_option('blog','blog_readmore_link');
							if($readmore <> '') : 
							?>
							
							<br />
							<a class="btn" href="<?php the_permalink();?>"><?php echo $readmore;?></a>
							<?php 
							endif;
							?>
							
                    	</div>
                    </div>
                </div>
                 <div class="medium-bg-h3">&nbsp;</div>
<?php
endwhile;
?>
                 
                 <?php tt_pagination();	?>
				 
